//
//  UIButton+Extension.m
//  OCSinaWeiBo
//
//  Created by Apple on 15/11/9.
//  Copyright © 2015年 itcast. All rights reserved.
//

#import "UIButton+Extension.h"

@implementation UIButton (Extension)

- (instancetype)initWithTitle:(NSString *)title bkgImageName:(NSString *)imageName titleColor:(UIColor *)color fontSize:(CGFloat)fontSize
{
    if (self = [super init])
    {
        [self setTitle:title forState:UIControlStateNormal];
        [self setTitleColor:color forState:UIControlStateNormal];
        self.titleLabel.font = [UIFont systemFontOfSize:fontSize];
        
        [self setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
        
        NSString *imageNameH = [NSString stringWithFormat:@"%@_highlighted", imageName];
        
        [self setBackgroundImage:[UIImage imageNamed:imageNameH] forState:UIControlStateHighlighted];
    }
    
    return self;
}

@end
